<script setup>
import { ref } from 'vue'
import { onClickOutside } from '@vueuse/core'

const container = ref(null)
// 触发元素以外的点击
onClickOutside(container, () => alert('触发点击'))
</script>

<template>
  <div>
    <p>点击这里</p>
    <div class="container" ref="container">
      <p>不要点击这里</p>
    </div>
  </div>
</template>
